home *** CD-ROM | disk | FTP | other *** search
- #include <stream.h>
- #include <stdlib.h>
- #include <string.h>
- #include <ctype.h>
- #include <stdio.h>
-
- #include "GUICINCLUDE:GUIC_Screen.hpp"
- #include "GUICINCLUDE:GUIC_Application.hpp"
- #include "GUICINCLUDE:GUIC_GGFXPicture.hpp"
- #include "GUICINCLUDE:GUIC_Text.hpp"
- #include "GUICINCLUDE:GUIC_Exceptions.hpp"
-
- #include "ThumbnailWindow.hpp"
-
- /*********************************************************************************************************/
-
- ThumbnailWindowC::ThumbnailWindowC (GUIC_ApplicationC &app, GUIC_ScreenC &screen) : GUIC_WindowC (-1,-1,10,10)
- {
- this->app = &app;
- this->screen = &screen;
- this->thumbnail = 0;
- this->width = 100;
- this->height = 100;
-
- textGadget = 0;
-
- setCloseGadgetMode ( FALSE );
- setZoomMode ( FALSE );
-
- setGuideContext("ThumbnailWindow");
- app.addPrefs("ThumbnailWindow", this);
-
- setTitle ( "Thumbnail" );
- }
- ThumbnailWindowC::~ThumbnailWindowC (VOID)
- {
- cleanUp();
- }
-
- /*********************************************************************************************************/
-
- VOID ThumbnailWindowC::setTextGadget (GUIC_TextC *t)
- {
- textGadget = t;
- }
- BOOL ThumbnailWindowC::loaded (VOID)
- {
- return (thumbnail != 0);
- }
-
- VOID ThumbnailWindowC::setDimensions (LONG x, LONG y)
- {
- width = x;
- height = y;
-
- setPixelWidth (x);
- setPixelHeight (y);
- }
- VOID ThumbnailWindowC::showThumbnail (STRPTR fileName)
- {
- if (thumbnail)
- {
- remove (thumbnail);
- delete thumbnail; thumbnail=0;
- }
-
- if (strcmp(fileName, "")) // then there is no thumbnail to show
- {
- try
- {
- if (textGadget) textGadget->set("Loading thumbnail ...");
- thumbnail = new GUIC_GGFXPictureC (fileName);
-
- if (textGadget) textGadget->set("Showing thumbnail." );
- thumbnail->setCentered(TRUE);
- add (thumbnail);
- }
- catch (GUIC_Exception &e)
- {
- if (thumbnail) { remove(thumbnail); delete thumbnail; thumbnail = 0; }
- if (textGadget) textGadget->set( "Could not load thumbnail.");
- }
- }
- }
-
- STRPTR ThumbnailWindowC::getClass (VOID)
- {
- return "ThumbnailWindowC";
- }
-
- /*********************************************************************************************************/
-
- VOID ThumbnailWindowC::cleanUp (VOID)
- {
- if (thumbnail)
- {
- remove (thumbnail);
- delete thumbnail;
- }
- }
-
-